package com.example.serverSide.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.serverSide.mapper.SysDeptMapper;
import com.example.serverSide.pojo.SysDept;
import com.example.serverSide.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
    @Autowired
    SysDeptMapper sysDeptMapper;
    @Override
    public SysDept getSysDeptById(String id) {
        LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<SysDept>();
        queryWrapper.eq(SysDept::getId,id);
        SysDept sysDept = this.getOne(queryWrapper);
        return sysDept;
    }

    @Override
    public List<SysDept> getDeptList() {
        LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<SysDept>();
        List<SysDept> sysDepts = sysDeptMapper.selectList(wrapper);
        return sysDepts;
    }

    @Override
    public void deleteDeptById(String id) {
        sysDeptMapper.deleteById(id);
    }
}
